home *** CD-ROM | disk | FTP | other *** search
/ POINT Software Programming / PPROG1.ISO / pascal / swag / screen.swg / 0044_Changing Borders ASM.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1993-11-02  |  1.5 KB  |  57 lines

  1. {
  2. SAM HASINOFF
  3.  
  4. > Can anyone help me With a Procedure that would let me change the
  5. > border colors on the screen?
  6.  
  7. You don't *need* to know BAsm, but it sure will help cut down on code size!
  8. Here is a plain-vanilla pascal Program which Uses the Dos Unit :( !
  9. }
  10.  
  11. Program BorderTest;
  12.  
  13. Uses
  14.   Dos;
  15.  
  16. Procedure border(colour : Byte);
  17. Var
  18.   regs : Registers;
  19. begin
  20.  regs.ah := $10;
  21.  regs.al := $01;
  22.  regs.bh := colour;
  23.  intr($10, regs);
  24. end;
  25.  
  26. begin
  27.   border(10);
  28. end;
  29.  
  30. { Now let's reWrite the Procedure using BAsm: }
  31.  
  32. Procedure border(colour : Byte); Assembler;
  33. Asm
  34.   mov ah, 10h
  35.   mov al, 01h
  36.   mov bh, colour
  37.   int 10h
  38. end;
  39.  
  40. {
  41. I almost never Program in BAsm, but have picked up just enough to do the
  42. above with a fair amount of certainty... The code is almost self explanatory:
  43.  
  44. The "mov" moves the second parameter into the first:
  45.   mov a,b    is equivalent to    a:=b;
  46.  
  47. (note: the h at the end of 10h, specifies that the number is hexadecimal, or
  48. base 16.  In pascal we Write $10 to mean 16, in BAsm we Write 10h)
  49.  
  50. The "int" command calls the specified interrupt... in the above example we
  51. are calling interrupt 10h (16).  I think the ah and al Registers tell the
  52. computer which Function and sub-Function of int 10h to call, While bh and bl
  53. are usually used as input values, and cx (something to do With the stack)
  54. is normally used as an output value (like an error result from a disk read)
  55. -- but don't quote me on any of that last sentence!
  56. }
  57.